home *** CD-ROM | disk | FTP | other *** search
- /*rx
- *
- * RestoreLhADir.rexx - Restore the directory buffer where the current LhA
- * archive buffer lives
- *
- * $VER: RestoreLhADir 40.4 (23/05/94) by Geoff Seeley
- *
- * Usage: ARexx command RestoreLhADir.rexx (from DOpus)
- *
- */
-
- /*--------------------------------------------------------------------------*/
-
- /* misc. variables */
-
- DOpusPort = 'DOPUS.1'
-
- if ~show(l,"rexxsupport.library") then
- call addlib("rexxsupport.library",0,-30,0)
-
- /* make sure we've got somebody to talk to */
-
- if showlist('Ports', DOpusPort) = 0 then do
- say 'Directory Opus ARexx port not found. Aborting.'
- call CleanUp
- end
-
- address 'DOPUS.1'
- options results
-
- TopText "Restore original buffered directory..."
-
- Busy on
-
- /* get window information from DOpus */
-
- Status 3
- CurrentWindow = result
-
- /* get the path/name of the LhA archive file */
-
- Status 14 CurrentWindow
- LhaFileName = result
-
- /* make sure it's an LhA archive listing buffer */
-
- if (IsLhAFile(LhaFileName) = 0) then do
-
- /* try other window */
-
- OtherWindow
- 'Status 14 -1'
- LhaFileName = Result
-
- if (IsLhAFile(LhaFileName) = 0) then do
-
- Notify "Sorry, no LhA archive buffer found.\You must use the ListLha button first."
- TopText "Restore aborted."
- call CleanUp
-
- end
-
- /* update current window */
-
- if CurrentWindow = 0 then
- CurrentWindow = 1
- else
- CurrentWindow = 0
-
- end
-
- /* get path to archive */
-
- call FindLhaPath
- LhaArchive = LhaPath || LhaFileName
-
- /* check for existance of archive */
-
- if ~exists(LhaArchive) then do
-
- Notify "Can't seem to find '" || LhaArchive || "'\Aborting."
- TopText "Restore aborted."
- call CleanUp
-
- end
-
- /* read in the directory */
-
- ClearWin CurrentWindow
- 'ScanDir "'||LhaPath||'"'
-
- /* re-select the archive file */
-
- 'Select '||LhaFileName||' onlyfiles'
-
- TopText "Restored Original Buffered Directory."
-
- call CleanUp
-
- exit
-
- /*--------------------------------------------------------------------------*/
-
- IsLhAFile: procedure /* look at extension, return 1 if right, else 0 */
-
- parse arg AFileName
-
- lps = lastpos(".", AFileName)
- if lps = 0 then
- return 0
-
- FileExt = upper(right(AFileName,length(AFileName)-lps))
-
- if FileExt ~= "LHA" & FileExt ~= "LZH" then
- return 0
- else
- return 1
-
- return 0
-
- /*--------------------------------------------------------------------------*/
-
- FindLhAPath: /* grab invisible file path to archive */
-
- /* find number of entries, path is the last one */
-
- 'Status 6 -1'
-
- GetEntry Result
- LhaPath = Result
-
- return
-
- /*--------------------------------------------------------------------------*/
-
- CleanUp: /* clean up files and exit */
-
- Busy off
- exit
-
- return
-
-